import request from '@/utils/request'

const prefix = "/api/webCourse"

// 获取课程列表
export function list(params) {
	return request({
		url: prefix + '/courseList',
		method: 'get',
		params: params
	})
}
//课程详情
export function courseDetails(courseId) {
	return request({
		url: prefix + `/courseDetails/${courseId}`,
		method: 'get',
	})
}
/**
 * 添加课程收藏
 */
export function addCollect(id) {
	return request({
		url: prefix + `/addCollect/${id}`,
		method: 'post',
	})
}

/**
 * 课程评论列表
 * @param params
 * @returns {AxiosPromise}
 */
export function evaluateList(params) {
    return request({
        url: `/api/webCourse/evaluateList`,
        method: 'get',
        params: params
    })
}


/**
 * 取消课程收藏
 */
export function delCollect(id) {
	return request({
		url: prefix + `/delCollect/${id}`,
		method: 'delete',
	})
}

/**
 * 课程章节的播放地址
 */
export function getVideoUrl(chapterId) {
	return request({
		url: prefix + `/getVideoUrl/${chapterId}`,
		method: 'get',
	})
}

